<!DOCTYPE html>
<script>
if (window.testRunner)
  testRunner.dumpAsText();
</script>
<p>PASS if no crash (stack overflow).</p>
<svg width="100" height="100">
  <rect fill="url(#p1)" width="100" height="100"/>
  <pattern id="p2" width="1" height="1">
    <g>
      <rect fill="url(#p1)" width="100" height="100"/>
    </g>
  </pattern>
  <pattern id="p1" width="1" height="1">
    <g>
      <rect fill="url(#p2)" width="100" height="100"/>
    </g>
  </pattern>
</svg>
